<?php

namespace Wilead\IArtistBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @ORM\Table
 * @ORM\Entity(repositoryClass="Wilead\IArtistBundle\Repository\AlipayHistoryRepository")
 */
class AlipayHistory {

    const WAIT_BUYER_PAY = 'WAIT_BUYER_PAY';
    const WAIT_SELLER_SEND_GOODS = 'WAIT_SELLER_SEND_GOODS';
    const WAIT_BUYER_CONFIRM_GOODS = 'WAIT_BUYER_CONFIRM_GOODS';
    const TRADE_FINISHED = 'TRADE_FINISHED';
    const TRADE_CLOSED = 'TRADE_CLOSED';

    public static $trans = array(
        self::WAIT_BUYER_PAY => '交易创建',
        self::WAIT_SELLER_SEND_GOODS => '买家付款成功',
        self::WAIT_BUYER_CONFIRM_GOODS => '卖家发货成功',
        self::TRADE_FINISHED => '交易成功结束',
        self::TRADE_CLOSED => '交易关闭'
    );

    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORM\Column(type="string")
     */
    private $outTradeNo;

    /**
     * @ORM\Column(type="string")
     */
    private $tradeNo;

    /**
     * @ORM\Column(type="string")
     */
    private $tradeStatus;

    /**
     * @ORM\Column(type="array", nullable=true)
     */
    private $info;

    /**
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $created;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set outTradeNo
     *
     * @param string $outTradeNo
     * @return AlipayHistory
     */
    public function setOutTradeNo($outTradeNo) {
        $this->outTradeNo = $outTradeNo;

        return $this;
    }

    /**
     * Get outTradeNo
     *
     * @return string 
     */
    public function getOutTradeNo() {
        return $this->outTradeNo;
    }

    /**
     * Set tradeNo
     *
     * @param string $tradeNo
     * @return AlipayHistory
     */
    public function setTradeNo($tradeNo) {
        $this->tradeNo = $tradeNo;

        return $this;
    }

    /**
     * Get tradeNo
     *
     * @return string 
     */
    public function getTradeNo() {
        return $this->tradeNo;
    }

    /**
     * Set tradeStatus
     *
     * @param string $tradeStatus
     * @return AlipayHistory
     */
    public function setTradeStatus($tradeStatus) {
        $this->tradeStatus = $tradeStatus;

        return $this;
    }

    /**
     * Get tradeStatus
     *
     * @return string 
     */
    public function getTradeStatus() {
        return $this->tradeStatus;
    }

    /**
     * Set info
     *
     * @param array $info
     * @return AlipayHistory
     */
    public function setInfo($info) {
        $this->info = $info;

        return $this;
    }

    /**
     * Get info
     *
     * @return array 
     */
    public function getInfo() {
        return $this->info;
    }

    /**
     * Set created
     *
     * @param \DateTime $created
     * @return AlipayHistory
     */
    public function setCreated($created) {
        $this->created = $created;

        return $this;
    }

    public function getStatus() {
        return self::$trans[$this->tradeStatus];
    }

    /**
     * Get created
     *
     * @return \DateTime 
     */
    public function getCreated() {
        return $this->created;
    }

}